package com.ytjj.qmyx.mall.controller.h5;

import com.ytjj.common.api.CommonResult;
import com.ytjj.common.controller.BaseController;
import com.ytjj.common.service.RedisService;
import com.ytjj.common.utils.SysConfigUtil;
import com.ytjj.common.utils.TokenUtil;
import com.ytjj.qmyx.mall.model.response.BrandListResponse;
import com.ytjj.qmyx.mall.service.ActivityService;
import com.ytjj.qmyx.mall.service.CommonService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/h5/brand/pavilion")
public class H5BrandPavilionController extends BaseController {
    @Resource
    private CommonService commonService;

    @Resource
    private ActivityService activityService;

    @Resource
    private SysConfigUtil sysConfigUtil;

    @Resource
    private RedisService redisService;

    /**
     * 根据专区id去查询品牌列表
     * @return
     */
    @GetMapping("/list")
    public CommonResult queryBrandListBySpecialId(@RequestParam(value = "pageNum") Integer pageNum,
                                            @RequestParam(value = "pageSize") Integer pageSize,
                                            @RequestParam Integer specialId){
        List<BrandListResponse> bankerSiteInfoList = commonService.getBrandPavilionList(pageNum,pageSize,specialId);
        return CommonResult.success(bankerSiteInfoList);
    }

    /**
     * 品牌内页
     * @return
     */
    @GetMapping("/info")
    public CommonResult queryBrandInfo(@RequestParam(value = "pageNum",required = false,defaultValue = "1") Integer pageNum,
                                        @RequestParam(value = "pageSize",required = false, defaultValue = "20") Integer pageSize,
                                        @RequestParam Integer id){

        return CommonResult.success(commonService.getBrandPavilionInfo(pageNum,pageSize,id,TokenUtil.getPlatformData()));
    }
}
